<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html>
<head><title>欢迎访问</title>
	<%@include file="./web.inc" %>
<style type="text/css">
</style>
</head>
<body>
	<form name="dataform1" action="" method="post">
		<button onclick="toUserLoginPage(this)">用户登陆</button>
		<br>
		<button onclick="toEasyUiPage(this)">EasyUi演示</button>

		<button onclick="funUserRegister(this)">ajax演示</button>

		<h1>一些表单演示</h1>
		<br> 输入 ：<input type="text"><br> 密码：<input
			type="password"><br> 提交：<input type="submit"><br>
		重置：<input type="reset"><br> 单选：<input type="radio"
			value="a"><input type="radio" value="B"><br> 多选：<input
			type="checkbox" value="a"><input type="checkbox" value="b"><br>
		按钮：<input type="button" value="ccc"><br>
		选择：
		<select>
			<option>aaaaaaaaaaaa</option>
			<option>aaaaaaaaaaaa</option>
			<option>aaaaaaaaaaaa</option>
			<option>aaaaaaaaaaaa</option>
		</select>
	</form>
	<script type="text/javascript">
		function toUserLoginPage() {
			var dform = document.all.dataform1;
			dform.action = "admin/UserAction!initUserLogin.action";
			dform.target = "_self";
			dform.submit();
		}
		function toEasyUiPage() {
			var dform = document.all.dataform1;
			dform.action = "admin/EasyuiDemoAction!queryEasyuiTree.action";
			dform.target = "_self";
			dform.submit();
		}

		/********/
		function funUserRegister() {// 用户注册
			$.ajax({
				contentType : "application/x-www-form-urlencoded",
				data : {
					'ajaxDemoVo.userLoginId' : 'admin',
					'ajaxDemoVo.password' : '1111111',
					'ajaxDemoVo.remark' : '备注'
				},
				dataType : "json",
				type : "POST",
				timeout : "3000",
				beforeSend : ajaxBeforeSend,
				error : ajaxError,
				success : ajaxSuccess,
				url : "admin/AjaxDemoAction!demo.action"
			});

		}

		function ajaxSuccess(data) {
			alert("成功：" + data);
			alert("成功：" + data.dataMap);
			alert(JSON.stringify(data));
		}

		function ajaxError(data) {
			alert("失败");
			alert("失败：" + data.success);
			alert("失败：" + data[0]);
		}

		function ajaxBeforeSend(data) {
		}
	</script>
</body>
</html>